package Acwing.数学知识;

import java.math.BigInteger;
import java.util.Scanner;

/**
 * @Title: myGcd
 * @Author 贾金博
 * @Package Acwing.数学知识
 * @Date 2025/4/11 下午5:59
 * @description: 最大公因数
 */
public class myGcd {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while (t -- > 0) {
            BigInteger a = sc.nextBigInteger();
            BigInteger b = sc.nextBigInteger();
            System.out.println(a.gcd(b));

        }
    }
}
